
EXEC = out/ParseMake.exe
TARGET =

CXX      = g++ -m64
CXXFLAGS = -Wall -fexceptions -g
INCLUDES = -Iclass
LDFLAGS  =
LIBS     = -lcomdlg32

ALL_SRC  = class/BufferString.cpp class/FunctionList.cpp class/ParseMake.cpp class/StringList.cpp main.cpp
ALL_OBJ  = $(ALL_SRC:%.cpp=out/%.o)

.PHONY: all clean run outdir

all: outdir $(EXEC)

outdir:
	mkdir -p out
	mkdir -p out/class

out/%.o: %.cpp
	$(CXX) -c $(CXXFLAGS) $(INCLUDES) -o $@ $<

$(EXEC): $(ALL_OBJ)
	$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)

run: all
ifdef TARGET
	$(EXEC) source/$(TARGET).prs $(TARGET).bin
else
	$(EXEC)
endif

clean:
	rm -f $(TARGET) $(ALL_OBJ)
